86

Beginner’s Guide to Code Algorithms

86

STEP 5 continued

    ‘Cells(i, 2) =​ GetAttr(Folder)

    If Right(Folder & B, 1) <> “\” Then

      FolderPath =​ Folder & B & “\”

    Else

Sub PopulateRow(ByRef i As Double, ByVal B As String, ByVal Folder As String)

      FolderPath =​ Folder & B

    End If

    If fs.folderExists(FolderPath) Then

      Set F =​ fs.GetFolder(FolderPath)

      Cells(i, 2) =​ “FOLDER”

    Else

      Set FI =​ fs.GetFile(Folder & B)

      Cells(i, 2) =​ “FILE”

    End If

    On Error GoTo Errormessage

    If Cells(i, 2).Value =​ “FOLDER” Then

      M =​ F.Attributes

      ‘If M And 16 Then

      ‘M =​ 1

      ‘End If

      Cells(i, 3) =​ F.Size

      Cells(i, 4) =​ F.Path

    Cells(i, 5) =​ F.DateLastModified

    Cells(i, 6) =​ F.Attributes

    Else

      M =​ FI.Attributes

      N =​ 0

      If M And 32 Then

      N =​ 1

      End If

      N =​ 0

      If M =​ 0 Then

      N =​ 99

      End If

      Cells(i, 3) =​ FI.Size

      Cells(i, 4) =​ FI.Path

      Cells(i, 5) =​ FI.DateLastModified

      Cells(i, 6) =​ FI.Attributes

   

    End If

    Exit Sub

Errormessage:

      Cells(i, 3) =​ “no access”

      Cells(i, 4) =​ “no access”

      Cells(i, 5) =​ “no access”

    End If

End Sub